package com.kexuexiong.demo.bear.controller.nacos;


import com.alibaba.nacos.api.config.annotation.NacosValue;
import com.kexuexiong.demo.bear.common.dto.Result;
import com.kexuexiong.demo.common.feignProvider.baseService.index.IndexFeignClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/nacos")
@Api(tags = {"nacos"})
public class NacosController {

    @NacosValue(value = "${file.download:d/}", autoRefreshed = true)
    private String fileDownloadUrl;

    @Autowired
    private IndexFeignClient indexFeign;

    @GetMapping(value = "/testNacos")
    @ApiOperation(value = "testNacos", notes = "测试nacos")
    public Result<String> testNacos() {
        return Result.success(fileDownloadUrl);
    }


    @GetMapping(value = "/indexFeign")
    @ApiOperation(value = "indexFeign", notes = "测试feign")
    public Result<String> indexFeign() {
        return Result.success(indexFeign.index("bear_web testing feign"));
    }

}
